/**
 * 
 */

$(window).load(function (){
	createMap();
	drawAllEvents();
});
$(document).ready(function() {
	$(".moreLink").click(function(){
		if(idUsuario){
			if($(this).parents(".commentLink").next(".commentForm:visible").length!=0){
				$(this).parents(".commentLink").next(".commentForm:visible").slideUp("fast");
				$(this).html("<b>Deja tu comentario!</b>");
			}
			else{
				$(this).parents(".commentLink").next(".commentForm:hidden").slideDown("fast");
				$(this).html("<b>Ocultar...</b>");
			}
		}
		else{
			alert("Conectate a ActinMap para comentar!");
		}
		
		return false;
	});
	var dates = $( "#from, #to" ).datepicker({
		defaultDate: "+1w",
		changeMonth: true,
		numberOfMonths: 1,
		onSelect: function( selectedDate ) {
			var option = this.id == "from" ? "minDate" : "maxDate",
					instance = $( this ).data( "datepicker" ),
					date = $.datepicker.parseDate(
						instance.settings.dateFormat ||
						$.datepicker._defaults.dateFormat,
						selectedDate, instance.settings );
				dates.not( this ).datepicker( "option", option, date );
		filter();		
		}
	});
});

	
